import { addNewsList } from "../blocks/news/newsList";
import { addNewsListDisorder } from "../blocks/news/newsListDisorder";
import { addImageList } from "../blocks/news/newsImageList";
import { addImageText } from "../blocks/news/newsImageText";
import { addImageTitle } from "../blocks/news/newsImageTitle";
import { addIntroduceList } from "../blocks/news/newsIntroduceList";

export const NewsBlockManager = (editor) => {
  // 有序列表
  const optsOrder = {
    id: "news-list",
    label: "News List",
    classPrefix: "news-list",
    style: "",
    styleAdditional: "",
  };
  addNewsList(editor, optsOrder);
  editor.BlockManager.add("news-list", {
    media: `<svg viewBox="0 0 24 24" style="width:30px; height:30px"><path d="M3 6h18v2H3zM3 10h18v2H3zM3 14h18v2H3zM3 18h18v2H3z"/></svg>`,
    label: "新闻列表",
    category: "新闻类",
    select: true,
    content: { type: "news-list" },
  });

  // 多列新闻
  const optsDisorder = {
    id: "news-list-disorder",
    label: "News List Disorder",
    classPrefix: "news-list-disorder",
    style: "",
    styleAdditional: "",
  };
  addNewsListDisorder(editor, optsDisorder);
  editor.BlockManager.add("news-list-disorder", {
    label: "多列新闻",
    category: "新闻类",
    media:`<svg t="1720769522976" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="35724" width="30" height="30"><path d="M198.193548 297.290323h620.544v38.779871H198.193548V297.290323z m0 193.915871h620.544v38.796387H198.193548V491.189677z m0 193.932387h620.544v38.779871H198.193548v-38.779871z" p-id="35725"></path></svg>`,
    select: true,
    content: { type: "news-list-disorder" },
  });

  // 图列表混排
  const optsImage = {
    id: "image-list",
    label: "Image List",
    classPrefix: "image-list",
    style: "",
    styleAdditional: "",
  };
  addImageList(editor, optsImage);
  editor.BlockManager.add("image-list", {
    label: "图列表混排",
    category: "新闻类",
    media:`<svg t="1720769656923" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="37637" width="30" height="30"><path d="M32 447.9h384c17.7 0 32-14.3 32-32V32c0-17.7-14.3-32-32-32H32C14.3 0 0 14.3 0 32v383.9c0 17.6 14.3 32 32 32zM64 64h320v319.9H64V64zM608 128h384c17.7 0 32-14.3 32-32s-14.3-32-32-32H608c-17.7 0-32 14.3-32 32s14.3 32 32 32zM992 480H608c-17.7 0-32 14.3-32 32s14.3 32 32 32h384c17.7 0 32-14.3 32-32s-14.3-32-32-32zM992 896H608c-17.7 0-32 14.3-32 32s14.3 32 32 32h384c17.7 0 32-14.3 32-32s-14.3-32-32-32zM263.1 552.4c-12.5-12.5-32.8-12.5-45.3 0L9.4 760.9c-6 6-9.4 14.1-9.4 22.6s3.4 16.6 9.4 22.6l208.4 208.4c6.2 6.2 14.4 9.4 22.6 9.4 8.2 0 16.4-3.1 22.6-9.4L471.5 806c6-6 9.4-14.1 9.4-22.6s-3.4-16.6-9.4-22.6L263.1 552.4z m-22.7 394.3L77.3 783.6l163.2-163.2 163.2 163.2-163.3 163.1z" p-id="37638"></path></svg>`,
    select: true,
    content: { type: "image-list" },
  });

  // 图文混排
  addImageText(editor)

  // 图标题文
  addImageTitle(editor)

  //新闻介绍列表
  addIntroduceList(editor);
};
